﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

public sealed class MyNumber
{
    private float fFirstNum;
    private Dictionary<string, float> dic_NumChange = new Dictionary<string, float>();

    public float Value { get; private set; }

    public MyNumber(float num)
    {
        fFirstNum = num;
        Value = fFirstNum;
    }

    public void AddChange(string guid, float num)
    {
        if (!dic_NumChange.ContainsKey(guid))
        {
            dic_NumChange.Add(guid, num);

            RefreshNum();
        }
    }
    public void RemoveChange(string guid)
    {
        if(dic_NumChange.ContainsKey(guid))
        {
            dic_NumChange.Remove(guid);

            RefreshNum();
        }
    }
    private void RefreshNum()
    {
        Value = fFirstNum;
        foreach (var item in dic_NumChange.Values)
        {
            Value *= item;
        }
    }
}
